panel.border = element_rect(colour = "black", fill=NA),
legend.background = element_blank(),
#aspect.ratio = 1, axis.text = element_text(colour = 1, size = 12),
legend.box.background = element_rect(colour = "black"))
dehumanization
ggsave(file="appendix_study2_dehumanization.pdf", width = 100, height = 100, units = "mm", dpi=1200)
setwd("../Study3_4")
data <- read_dta("study4_cleaned_coded.dta")
setwd("../Figures")
names(data)
getwd()
setwd("../Study3_4")
data <- read_dta("study4_cleaned_coded_v2.dta")
data <- read_dta("study4_data_coded_v2.dta")
setwd("../Tables")
datam <- subset(data, treat2>2)
dataw <- subset(data, treat2<3)
Solidarity4_W <- lm(M_index~code6*treat2, data=dataw)
Solidarity4_M <- lm(M_index~code6*treat2, data=datam)
summary(Solidarity4_M)
stargazer(Solidarity4_M,Solidarity4_W,
column.labels = c("Muslim", "White"),
covariate.labels = c("Solidarity", "Derogation", "Solidarity X Derogation")
)
data <- read_dta("study4_cleaned_coded.dta")
##### Black Sample MW Interactions
datam <- subset(data, treat2>2)
dataw <- subset(data, treat2<3)
datab <- subset(data, treat1>2)
dataw <- subset(data, treat1<3)
dataw2 <- subset(data, treat2<3)
atam <- subset(data, treat2>2)
dataw <- subset(data, treat2<3)
Solidarity4_W <- lm(M_index~code6*treat2, data=dataw)
Solidarity4_M <- lm(M_index~code6*treat2, data=datam)
stargazer(Solidarity4_M,Solidarity4_W,
column.labels = c("Muslim", "White"),
covariate.labels = c("Solidarity", "Derogation", "Solidarity X Derogation"))
setwd("C:/Users/Tabi/Dropbox/ingroup derogation and white response/Replication/AppendixStudies")
library(foreign)
#library(reshape)
library(tidyverse)
library(ggplot2)
library(effsize)
library(xlsx)
library(haven)
se <- function(x) sd(x)/sqrt(length(x))
#####EDUCATION#####
data_ed <- read_dta('education_data.dta', convert.factors=FALSE)
#####EDUCATION#####
data_ed <- read_dta('education_data.dta')
#### SPLIT ON PID ###
data_ed$pid7 <- data_ed$Q58
data_ed$pid7[data_ed$Q56==3 & data_ed$Q59==1]<-3
data_ed$pid7[data_ed$Q56==3 & data_ed$Q59==3]<- 4
data_ed$pid7[data_ed$Q56==3 & data_ed$Q59==2] <-5
data_ed$pid7[data_ed$Q57==2]<- 6
data_ed$pid7[data_ed$Q57==1] <-7
data_ed$rep[data_ed$pid7>4] <- 1
data_ed$rep[data_ed$pid7<=4] <- 0
data_ed$dem[data_ed$pid7>4] <- 0
data_ed$dem[data_ed$pid7<4] <- 1
REPed <- subset(data_ed, pid7>4)
DEMed <- subset(data_ed, pid7<4)
gen <- data.frame(
x = as.factor(c(rep(c(1:2),2),rep(c(1:2),2))),
cond = as.factor(c(1,1,1,1,1,1,1,1)),
dv = as.factor(c(rep("Agree",4),rep("Vote",4))),
rr_def = c(rep("Republican",2),rep("Democrat",2),rep("Republican",2),rep("Democrat",2)),
y = c(mean(na.omit(REPed$AgreeCandidate[REPed$treat==1])),
mean(na.omit(REPed$AgreeCandidate[REPed$treat==3])),
mean(na.omit(DEMed$AgreeCandidate[DEMed$treat==1])),
mean(na.omit(DEMed$AgreeCandidate[DEMed$treat==3])),
mean(na.omit(REPed$vote[REPed$treat==1])),
mean(na.omit(REPed$vote[REPed$treat==3])),
mean(na.omit(DEMed$vote[DEMed$treat==1])),
mean(na.omit(DEMed$vote[DEMed$treat==3]))),
se = c(se(na.omit(REPed$AgreeCandidate[REPed$treat==1])),
se(na.omit(REPed$AgreeCandidate[REPed$treat==3])),
se(na.omit(DEMed$AgreeCandidate[DEMed$treat==1])),
se(na.omit(DEMed$AgreeCandidate[DEMed$treat==3])),
se(na.omit(REPed$vote[REPed$treat==1])),
se(na.omit(REPed$vote[REPed$treat==3])),
se(na.omit(DEMed$vote[DEMed$treat==1])),
se(na.omit(DEMed$vote[DEMed$treat==3])))
)
RRlow.ed <- subset(data_ed, symrace<.5)
RRhi.ed <- subset(data_ed, symrace>.5)
gen <- data.frame(
x = as.factor(c(rep(c(1:2),2),rep(c(1:2),2))),
cond = as.factor(c(1,1,1,1,1,1,1,1)),
dv = as.factor(c(rep("Agree",4),rep("Vote",4))),
rr_def = c(rep("High RR",2),rep("Low RR",2),rep("High RR",2),rep("Low RR",2)),
y = c(mean(na.omit(RRhi.ed$AgreeCandidate[RRhi.ed$treat==1])),
mean(na.omit(RRhi.ed$AgreeCandidate[RRhi.ed$treat==3])),
mean(na.omit(RRlow.ed$AgreeCandidate[RRlow.ed$treat==1])),
mean(na.omit(RRlow.ed$AgreeCandidate[RRlow.ed$treat==3])),
mean(na.omit(RRhi.ed$vote[RRhi.ed$treat==1])),
mean(na.omit(RRhi.ed$vote[RRhi.ed$treat==3])),
mean(na.omit(RRlow.ed$vote[RRlow.ed$treat==1])),
mean(na.omit(RRlow.ed$vote[RRlow.ed$treat==3]))),
se = c(se(na.omit(RRhi.ed$AgreeCandidate[RRhi.ed$treat==1])),
se(na.omit(RRhi.ed$AgreeCandidate[RRhi.ed$treat==3])),
se(na.omit(RRlow.ed$AgreeCandidate[RRlow.ed$treat==1])),
se(na.omit(RRlow.ed$AgreeCandidate[RRlow.ed$treat==3])),
se(na.omit(RRhi.ed$vote[RRhi.ed$treat==1])),
se(na.omit(RRhi.ed$vote[RRhi.ed$treat==3])),
se(na.omit(RRlow.ed$vote[RRlow.ed$treat==1])),
se(na.omit(RRlow.ed$vote[RRlow.ed$treat==3])))
)
g <- ggplot(gen,aes(x=dv,y=y,ymin=y-(1.96*se),ymax=y+(1.96*se),width= 0.5, colour = x, shape=x))
g+  coord_cartesian(ylim=c(0,1)) +
geom_pointrange(size= 0.25, position = position_dodge(width=.5)) +
scale_shape_manual(name="Treatment",values=c(4,5),
labels=c("White Derogator","Black Derogator")) +
scale_color_manual(name="Treatment",values=c("grey45","black"),
labels=c("White Derogator","Black Derogator")) +
scale_fill_manual(values=c("grey45","black")) +
#scale_x_discrete(breaks=c("1","2"),labels=c("White \nCandidate","Black \nCandidate"))
coord_flip() +
#geom_hline(yintercept=0, linetype="longdash", size=0.5) +
labs( x = "Dependent Variable", y= "Mean", color = "Category") +
facet_grid(.~rr_def,labeller = label_value,space="free")+
theme_bw()
#### SPLIT ON PID ###
data_ed$pid7 <- data_ed$Q58
data_ed$pid7[data_ed$Q56==3 & data_ed$Q59==1]<-3
data_ed$pid7[data_ed$Q56==3 & data_ed$Q59==3]<- 4
data_ed$pid7[data_ed$Q56==3 & data_ed$Q59==2] <-5
data_ed$pid7[data_ed$Q57==2]<- 6
data_ed$pid7[data_ed$Q57==1] <-7
data_ed$rep[data_ed$pid7>4] <- 1
data_ed$rep[data_ed$pid7<=4] <- 0
data_ed$dem[data_ed$pid7>4] <- 0
data_ed$dem[data_ed$pid7<4] <- 1
REPed <- subset(data_ed, pid7>4)
DEMed <- subset(data_ed, pid7<4)
gen <- data.frame(
x = as.factor(c(rep(c(1:2),2),rep(c(1:2),2))),
cond = as.factor(c(1,1,1,1,1,1,1,1)),
dv = as.factor(c(rep("Agree",4),rep("Vote",4))),
rr_def = c(rep("Republican",2),rep("Democrat",2),rep("Republican",2),rep("Democrat",2)),
y = c(mean(na.omit(REPed$AgreeCandidate[REPed$treat==1])),
mean(na.omit(REPed$AgreeCandidate[REPed$treat==3])),
mean(na.omit(DEMed$AgreeCandidate[DEMed$treat==1])),
mean(na.omit(DEMed$AgreeCandidate[DEMed$treat==3])),
mean(na.omit(REPed$vote[REPed$treat==1])),
mean(na.omit(REPed$vote[REPed$treat==3])),
mean(na.omit(DEMed$vote[DEMed$treat==1])),
mean(na.omit(DEMed$vote[DEMed$treat==3]))),
se = c(se(na.omit(REPed$AgreeCandidate[REPed$treat==1])),
se(na.omit(REPed$AgreeCandidate[REPed$treat==3])),
se(na.omit(DEMed$AgreeCandidate[DEMed$treat==1])),
se(na.omit(DEMed$AgreeCandidate[DEMed$treat==3])),
se(na.omit(REPed$vote[REPed$treat==1])),
se(na.omit(REPed$vote[REPed$treat==3])),
se(na.omit(DEMed$vote[DEMed$treat==1])),
se(na.omit(DEMed$vote[DEMed$treat==3])))
)
RRlow.ed <- subset(data_ed, symrace<.5)
RRhi.ed <- subset(data_ed, symrace>.5)
gen <- data.frame(
x = as.factor(c(rep(c(1:2),2),rep(c(1:2),2))),
cond = as.factor(c(1,1,1,1,1,1,1,1)),
dv = as.factor(c(rep("Agree",4),rep("Vote",4))),
rr_def = c(rep("High RR",2),rep("Low RR",2),rep("High RR",2),rep("Low RR",2)),
y = c(mean(na.omit(RRhi.ed$AgreeCandidate[RRhi.ed$treat==1])),
mean(na.omit(RRhi.ed$AgreeCandidate[RRhi.ed$treat==3])),
mean(na.omit(RRlow.ed$AgreeCandidate[RRlow.ed$treat==1])),
mean(na.omit(RRlow.ed$AgreeCandidate[RRlow.ed$treat==3])),
mean(na.omit(RRhi.ed$vote[RRhi.ed$treat==1])),
mean(na.omit(RRhi.ed$vote[RRhi.ed$treat==3])),
mean(na.omit(RRlow.ed$vote[RRlow.ed$treat==1])),
mean(na.omit(RRlow.ed$vote[RRlow.ed$treat==3]))),
se = c(se(na.omit(RRhi.ed$AgreeCandidate[RRhi.ed$treat==1])),
se(na.omit(RRhi.ed$AgreeCandidate[RRhi.ed$treat==3])),
se(na.omit(RRlow.ed$AgreeCandidate[RRlow.ed$treat==1])),
se(na.omit(RRlow.ed$AgreeCandidate[RRlow.ed$treat==3])),
se(na.omit(RRhi.ed$vote[RRhi.ed$treat==1])),
se(na.omit(RRhi.ed$vote[RRhi.ed$treat==3])),
se(na.omit(RRlow.ed$vote[RRlow.ed$treat==1])),
se(na.omit(RRlow.ed$vote[RRlow.ed$treat==3])))
)
g <- ggplot(gen,aes(x=dv,y=y,ymin=y-(1.96*se),ymax=y+(1.96*se),width= 0.5, colour = x, shape=x))
g+  coord_cartesian(ylim=c(0,1)) +
geom_pointrange(size= 0.25, position = position_dodge(width=.5)) +
scale_shape_manual(name="Treatment",values=c(4,5),
labels=c("White Derogator","Black Derogator")) +
scale_color_manual(name="Treatment",values=c("grey45","black"),
labels=c("White Derogator","Black Derogator")) +
scale_fill_manual(values=c("grey45","black")) +
#scale_x_discrete(breaks=c("1","2"),labels=c("White \nCandidate","Black \nCandidate"))
coord_flip() +
#geom_hline(yintercept=0, linetype="longdash", size=0.5) +
labs( x = "Dependent Variable", y= "Mean", color = "Category") +
facet_grid(.~rr_def,labeller = label_value,space="free")+
theme_bw()
ggsave(file="educationRR_figure.pdf",device="pdf",width = 175, height = 125, units = "mm" )
gen <- data.frame(
x = as.factor(c(rep(c(1:2),2),rep(c(1:2),2))),
cond = as.factor(c(1,1,1,1,1,1,1,1)),
dv = as.factor(c(rep("Agree",4),rep("Vote",4))),
rr_def = c(rep("Republican",2),rep("Democrat",2),rep("Republican",2),rep("Democrat",2)),
y = c(mean(na.omit(REPed$AgreeCandidate[REPed$treat==1])),
mean(na.omit(REPed$AgreeCandidate[REPed$treat==3])),
mean(na.omit(DEMed$AgreeCandidate[DEMed$treat==1])),
mean(na.omit(DEMed$AgreeCandidate[DEMed$treat==3])),
mean(na.omit(REPed$vote[REPed$treat==1])),
mean(na.omit(REPed$vote[REPed$treat==3])),
mean(na.omit(DEMed$vote[DEMed$treat==1])),
mean(na.omit(DEMed$vote[DEMed$treat==3]))),
se = c(se(na.omit(REPed$AgreeCandidate[REPed$treat==1])),
se(na.omit(REPed$AgreeCandidate[REPed$treat==3])),
se(na.omit(DEMed$AgreeCandidate[DEMed$treat==1])),
se(na.omit(DEMed$AgreeCandidate[DEMed$treat==3])),
se(na.omit(REPed$vote[REPed$treat==1])),
se(na.omit(REPed$vote[REPed$treat==3])),
se(na.omit(DEMed$vote[DEMed$treat==1])),
se(na.omit(DEMed$vote[DEMed$treat==3])))
)
g <- ggplot(gen,aes(x=dv,y=y,ymin=y-(1.96*se),ymax=y+(1.96*se),width= 0.5, colour = x, shape=x))
g+  coord_cartesian(ylim=c(0,1)) +
geom_pointrange(size= 0.25, position = position_dodge(width=.5)) +
scale_shape_manual(name="Treatment",values=c(4,5),
labels=c("White Derogator","Black Derogator")) +
scale_color_manual(name="Treatment",values=c("grey45","black"),
labels=c("White Derogator","Black Derogator")) +
scale_fill_manual(values=c("grey45","black")) +
#scale_x_discrete(breaks=c("1","2"),labels=c("White \nCandidate","Black \nCandidate"))
coord_flip() +
#geom_hline(yintercept=0, linetype="longdash", size=0.5) +
labs( x = "Dependent Variable", y= "Mean", color = "Category") +
facet_grid(.~rr_def,labeller = label_value,space="free")+
theme_bw()
ggsave(file="educationPID_figure.pdf",device="pdf",width = 175, height = 125, units = "mm" )
data_wel <- read_dta('welfare_data.dta')
#### SPLIT ON PID ###
data_wel$pid7 <- data_wel$Q58
data_wel$pid7[data_wel$Q56==3 & data_wel$Q59==1]<-3
data_wel$pid7[data_wel$Q56==3 & data_wel$Q59==3]<- 4
data_wel$pid7[data_wel$Q56==3 & data_wel$Q59==2] <-5
data_wel$pid7[data_wel$Q57==2]<- 6
data_wel$pid7[data_wel$Q57==1] <-7
data_wel$dem[data_wel$pid7>4]<-0
data_wel$dem[data_wel$pid7<4]<- 1
data_wel$rep[data_wel$pid7>4]<-1
data_wel$rep[data_wel$pid7<=4]<- 0
REPwel <- subset(data_wel, pid7>4)
DEMwel <- subset(data_wel, pid7<4)
data_wel$RRhi[data_wel$symrace>=.5] <-1
data_wel$RRhi[data_wel$symrace<.5] <-0
RRhi.wel <- subset(data_wel, RRhi=1)
RRlow.wel <- subset(data_wel, RRhi=0)
gen <- data.frame(
x = as.factor(c(rep(c(1:2),2),rep(c(1:2),2))),
cond = as.factor(c(1,1,1,1,1,1,1,1)),
dv = as.factor(c(rep("Agree",4),rep("Vote",4))),
rr_def = c(rep("Republican",2),rep("Democrat",2),rep("Republican",2),rep("Democrat",2)),
y = c(mean(na.omit(REPwel$agree[REPwel$treat==5])),
mean(na.omit(REPwel$agree[REPwel$treat==6])),
mean(na.omit(DEMwel$agree[DEMwel$treat==5])),
mean(na.omit(DEMwel$agree[DEMwel$treat==6])),
mean(na.omit(REPwel$vote[REPwel$treat==5])),
mean(na.omit(REPwel$vote[REPwel$treat==6])),
mean(na.omit(DEMwel$vote[DEMwel$treat==5])),
mean(na.omit(DEMwel$vote[DEMwel$treat==6]))),
se = c(se(na.omit(REPwel$agree[REPwel$treat==5])),
se(na.omit(REPwel$agree[REPwel$treat==6])),
se(na.omit(DEMwel$agree[DEMwel$treat==5])),
se(na.omit(DEMwel$agree[DEMwel$treat==6])),
se(na.omit(REPwel$vote[REPwel$treat==5])),
se(na.omit(REPwel$vote[REPwel$treat==6])),
se(na.omit(DEMwel$vote[DEMwel$treat==5])),
se(na.omit(DEMwel$vote[DEMwel$treat==6])))
)
g <- ggplot(gen,aes(x=dv,y=y,ymin=y-(1.96*se),ymax=y+(1.96*se),width= 0.5, colour = x, shape=x))
g+  coord_cartesian(ylim=c(0,1)) +
geom_pointrange(size= 0.25, position = position_dodge(width=.5)) +
scale_shape_manual(name="Treatment",values=c(4,5),
labels=c("White Derogator","Black Derogator")) +
scale_color_manual(name="Treatment",values=c("grey45","black"),
labels=c("White Derogator","Black Derogator")) +
scale_fill_manual(values=c("grey45","black")) +
#scale_x_discrete(breaks=c("1","2"),labels=c("White \nCandidate","Black \nCandidate"))
coord_flip() +
#geom_hline(yintercept=0, linetype="longdash", size=0.5) +
labs( x = "Dependent Variable", y= "Mean", color = "Category") +
facet_grid(.~rr_def,labeller = label_value,space="free")+
theme_bw()
g
gen
data_wel <- read_dta('welfare_data.dta')
summary(data_wel)
#### SPLIT ON PID ###
data_wel$pid7 <- data_wel$Q58
data_wel$pid7[data_wel$Q56==3 & data_wel$Q59==1]<-3
data_wel$pid7[data_wel$Q56==3 & data_wel$Q59==3]<- 4
data_wel$pid7[data_wel$Q56==3 & data_wel$Q59==2] <-5
data_wel$pid7[data_wel$Q57==2]<- 6
data_wel$pid7[data_wel$Q57==1] <-7
data_wel$dem[data_wel$pid7>4]<-0
data_wel$dem[data_wel$pid7<4]<- 1
data_wel$rep[data_wel$pid7>4]<-1
data_wel$rep[data_wel$pid7<=4]<- 0
REPwel <- subset(data_wel, pid7>4)
DEMwel <- subset(data_wel, pid7<4)
RRhi.wel <- subset(data_wel, RRhi=1)
RRlow.wel <- subset(data_wel, RRhi=0)
gen <- data.frame(
x = as.factor(c(rep(c(1:2),2),rep(c(1:2),2))),
cond = as.factor(c(1,1,1,1,1,1,1,1)),
dv = as.factor(c(rep("Agree",4),rep("Vote",4))),
rr_def = c(rep("Republican",2),rep("Democrat",2),rep("Republican",2),rep("Democrat",2)),
y = c(mean(na.omit(REPwel$agree[REPwel$treat==5])),
mean(na.omit(REPwel$agree[REPwel$treat==6])),
mean(na.omit(DEMwel$agree[DEMwel$treat==5])),
mean(na.omit(DEMwel$agree[DEMwel$treat==6])),
mean(na.omit(REPwel$vote[REPwel$treat==5])),
mean(na.omit(REPwel$vote[REPwel$treat==6])),
mean(na.omit(DEMwel$vote[DEMwel$treat==5])),
mean(na.omit(DEMwel$vote[DEMwel$treat==6]))),
se = c(se(na.omit(REPwel$agree[REPwel$treat==5])),
se(na.omit(REPwel$agree[REPwel$treat==6])),
se(na.omit(DEMwel$agree[DEMwel$treat==5])),
se(na.omit(DEMwel$agree[DEMwel$treat==6])),
se(na.omit(REPwel$vote[REPwel$treat==5])),
se(na.omit(REPwel$vote[REPwel$treat==6])),
se(na.omit(DEMwel$vote[DEMwel$treat==5])),
se(na.omit(DEMwel$vote[DEMwel$treat==6])))
)
warnings()
names(data_wel
)
data_wel2 <- read_dta("Ben_Carsonlegitimizing_prejudice 11072015.dta")
names(data_wel2)
summary(data_wel$treatment)
data_wel$pid7 <- data_wel$Q58
data_wel$pid7[data_wel$Q56==3 & data_wel$Q59==1]<-3
data_wel$pid7[data_wel$Q56==3 & data_wel$Q59==3]<- 4
data_wel$pid7[data_wel$Q56==3 & data_wel$Q59==2] <-5
data_wel$pid7[data_wel$Q57==2]<- 6
data_wel$pid7[data_wel$Q57==1] <-7
data_wel$dem[data_wel$pid7>4]<-0
data_wel$dem[data_wel$pid7<4]<- 1
data_wel$rep[data_wel$pid7>4]<-1
data_wel$rep[data_wel$pid7<=4]<- 0
REPwel <- subset(data_wel, pid7>4)
DEMwel <- subset(data_wel, pid7<4)
gen <- data.frame(
x = as.factor(c(rep(c(1:2),2),rep(c(1:2),2))),
cond = as.factor(c(1,1,1,1,1,1,1,1)),
dv = as.factor(c(rep("Agree",4),rep("Vote",4))),
rr_def = c(rep("Republican",2),rep("Democrat",2),rep("Republican",2),rep("Democrat",2)),
y = c(mean(na.omit(REPwel$agree[REPwel$treatment==5])),
mean(na.omit(REPwel$agree[REPwel$treatment==6])),
mean(na.omit(DEMwel$agree[DEMwel$treatment==5])),
mean(na.omit(DEMwel$agree[DEMwel$treatment==6])),
mean(na.omit(REPwel$vote[REPwel$treatment==5])),
mean(na.omit(REPwel$vote[REPwel$treatment==6])),
mean(na.omit(DEMwel$vote[DEMwel$treatment==5])),
mean(na.omit(DEMwel$vote[DEMwel$treatment==6]))),
se = c(se(na.omit(REPwel$agree[REPwel$treatment==5])),
se(na.omit(REPwel$agree[REPwel$treatment==6])),
se(na.omit(DEMwel$agree[DEMwel$treatment==5])),
se(na.omit(DEMwel$agree[DEMwel$treatment==6])),
se(na.omit(REPwel$vote[REPwel$treatment==5])),
se(na.omit(REPwel$vote[REPwel$treatment==6])),
se(na.omit(DEMwel$vote[DEMwel$treatment==5])),
se(na.omit(DEMwel$vote[DEMwel$treatment==6])))
)
g <- ggplot(gen,aes(x=dv,y=y,ymin=y-(1.96*se),ymax=y+(1.96*se),width= 0.5, colour = x, shape=x))
g+  coord_cartesian(ylim=c(0,1)) +
geom_pointrange(size= 0.25, position = position_dodge(width=.5)) +
scale_shape_manual(name="Treatment",values=c(4,5),
labels=c("White Derogator","Black Derogator")) +
scale_color_manual(name="Treatment",values=c("grey45","black"),
labels=c("White Derogator","Black Derogator")) +
scale_fill_manual(values=c("grey45","black")) +
#scale_x_discrete(breaks=c("1","2"),labels=c("White \nCandidate","Black \nCandidate"))
coord_flip() +
#geom_hline(yintercept=0, linetype="longdash", size=0.5) +
labs( x = "Dependent Variable", y= "Mean", color = "Category") +
facet_grid(.~rr_def,labeller = label_value,space="free")+
theme_bw()
gen <- data.frame(
x = as.factor(c(rep(c(1:2),2),rep(c(1:2),2))),
cond = as.factor(c(1,1,1,1,1,1,1,1)),
dv = as.factor(c(rep("Agree",4),rep("Vote",4))),
rr_def = c(rep("Republican",2),rep("Democrat",2),rep("Republican",2),rep("Democrat",2)),
y = c(mean(na.omit(REPed$AgreeCandidate[REPed$treat==1])),
mean(na.omit(REPed$AgreeCandidate[REPed$treat==3])),
mean(na.omit(DEMed$AgreeCandidate[DEMed$treat==1])),
mean(na.omit(DEMed$AgreeCandidate[DEMed$treat==3])),
mean(na.omit(REPed$vote[REPed$treat==1])),
mean(na.omit(REPed$vote[REPed$treat==3])),
mean(na.omit(DEMed$vote[DEMed$treat==1])),
mean(na.omit(DEMed$vote[DEMed$treat==3]))),
se = c(se(na.omit(REPed$AgreeCandidate[REPed$treat==1])),
se(na.omit(REPed$AgreeCandidate[REPed$treat==3])),
se(na.omit(DEMed$AgreeCandidate[DEMed$treat==1])),
se(na.omit(DEMed$AgreeCandidate[DEMed$treat==3])),
se(na.omit(REPed$vote[REPed$treat==1])),
se(na.omit(REPed$vote[REPed$treat==3])),
se(na.omit(DEMed$vote[DEMed$treat==1])),
se(na.omit(DEMed$vote[DEMed$treat==3])))
)
g <- ggplot(gen,aes(x=dv,y=y,ymin=y-(1.96*se),ymax=y+(1.96*se),width= 0.5, colour = x, shape=x))
g+  coord_cartesian(ylim=c(0,1)) +
geom_pointrange(size= 0.25, position = position_dodge(width=.5)) +
scale_shape_manual(name="Treatment",values=c(4,5),
labels=c("White Derogator","Black Derogator")) +
scale_color_manual(name="Treatment",values=c("grey45","black"),
labels=c("White Derogator","Black Derogator")) +
scale_fill_manual(values=c("grey45","black")) +
#scale_x_discrete(breaks=c("1","2"),labels=c("White \nCandidate","Black \nCandidate"))
coord_flip() +
#geom_hline(yintercept=0, linetype="longdash", size=0.5) +
labs( x = "Dependent Variable", y= "Mean", color = "Category") +
facet_grid(.~rr_def,labeller = label_value,space="free")+
theme_bw()
ggsave(file="educationPID_figure.pdf",device="pdf",width = 175, height = 125, units = "mm" )
RRlow.ed <- subset(data_ed, symrace<.5)
RRhi.ed <- subset(data_ed, symrace>.5)
gen <- data.frame(
x = as.factor(c(rep(c(1:2),2),rep(c(1:2),2))),
cond = as.factor(c(1,1,1,1,1,1,1,1)),
dv = as.factor(c(rep("Agree",4),rep("Vote",4))),
rr_def = c(rep("High RR",2),rep("Low RR",2),rep("High RR",2),rep("Low RR",2)),
y = c(mean(na.omit(RRhi.ed$AgreeCandidate[RRhi.ed$treat==1])),
mean(na.omit(RRhi.ed$AgreeCandidate[RRhi.ed$treat==3])),
mean(na.omit(RRlow.ed$AgreeCandidate[RRlow.ed$treat==1])),
mean(na.omit(RRlow.ed$AgreeCandidate[RRlow.ed$treat==3])),
mean(na.omit(RRhi.ed$vote[RRhi.ed$treat==1])),
mean(na.omit(RRhi.ed$vote[RRhi.ed$treat==3])),
mean(na.omit(RRlow.ed$vote[RRlow.ed$treat==1])),
mean(na.omit(RRlow.ed$vote[RRlow.ed$treat==3]))),
se = c(se(na.omit(RRhi.ed$AgreeCandidate[RRhi.ed$treat==1])),
se(na.omit(RRhi.ed$AgreeCandidate[RRhi.ed$treat==3])),
se(na.omit(RRlow.ed$AgreeCandidate[RRlow.ed$treat==1])),
se(na.omit(RRlow.ed$AgreeCandidate[RRlow.ed$treat==3])),
se(na.omit(RRhi.ed$vote[RRhi.ed$treat==1])),
se(na.omit(RRhi.ed$vote[RRhi.ed$treat==3])),
se(na.omit(RRlow.ed$vote[RRlow.ed$treat==1])),
se(na.omit(RRlow.ed$vote[RRlow.ed$treat==3])))
)
g <- ggplot(gen,aes(x=dv,y=y,ymin=y-(1.96*se),ymax=y+(1.96*se),width= 0.5, colour = x, shape=x))
g+  coord_cartesian(ylim=c(0,1)) +
geom_pointrange(size= 0.25, position = position_dodge(width=.5)) +
scale_shape_manual(name="Treatment",values=c(4,5),
labels=c("White Candidate","Black Candidate")) +
scale_color_manual(name="Treatment",values=c("grey45","black"),
labels=c("White Candidate","Black Candidate")) +
scale_fill_manual(values=c("grey45","black")) +
#scale_x_discrete(breaks=c("1","2"),labels=c("White \nCandidate","Black \nCandidate"))
coord_flip() +
#geom_hline(yintercept=0, linetype="longdash", size=0.5) +
labs( x = "Dependent Variable", y= "Mean", color = "Category") +
facet_grid(.~rr_def,labeller = label_value,space="free")+
theme_bw()
ggsave(file="educationRR_figure.pdf",device="pdf",width = 175, height = 125, units = "mm" )
############################ WELFARE #######################################
data_wel <- read_dta('welfare_data.dta')
#### SPLIT ON PID ###
data_wel$pid7 <- data_wel$Q58
data_wel$pid7[data_wel$Q56==3 & data_wel$Q59==1]<-3
data_wel$pid7[data_wel$Q56==3 & data_wel$Q59==3]<- 4
data_wel$pid7[data_wel$Q56==3 & data_wel$Q59==2] <-5
data_wel$pid7[data_wel$Q57==2]<- 6
data_wel$pid7[data_wel$Q57==1] <-7
data_wel$dem[data_wel$pid7>4]<-0
data_wel$dem[data_wel$pid7<4]<- 1
data_wel$rep[data_wel$pid7>4]<-1
data_wel$rep[data_wel$pid7<=4]<- 0
REPwel <- subset(data_wel, pid7>4)
DEMwel <- subset(data_wel, pid7<4)
gen <- data.frame(
x = as.factor(c(rep(c(1:2),2),rep(c(1:2),2))),
cond = as.factor(c(1,1,1,1,1,1,1,1)),
dv = as.factor(c(rep("Agree",4),rep("Vote",4))),
rr_def = c(rep("Republican",2),rep("Democrat",2),rep("Republican",2),rep("Democrat",2)),
y = c(mean(na.omit(REPwel$agree[REPwel$treatment==5])),
mean(na.omit(REPwel$agree[REPwel$treatment==6])),
mean(na.omit(DEMwel$agree[DEMwel$treatment==5])),
mean(na.omit(DEMwel$agree[DEMwel$treatment==6])),
mean(na.omit(REPwel$vote[REPwel$treatment==5])),
mean(na.omit(REPwel$vote[REPwel$treatment==6])),
mean(na.omit(DEMwel$vote[DEMwel$treatment==5])),
mean(na.omit(DEMwel$vote[DEMwel$treatment==6]))),
se = c(se(na.omit(REPwel$agree[REPwel$treatment==5])),
se(na.omit(REPwel$agree[REPwel$treatment==6])),
se(na.omit(DEMwel$agree[DEMwel$treatment==5])),
se(na.omit(DEMwel$agree[DEMwel$treatment==6])),
se(na.omit(REPwel$vote[REPwel$treatment==5])),
se(na.omit(REPwel$vote[REPwel$treatment==6])),
se(na.omit(DEMwel$vote[DEMwel$treatment==5])),
se(na.omit(DEMwel$vote[DEMwel$treatment==6])))
)
g <- ggplot(gen,aes(x=dv,y=y,ymin=y-(1.96*se),ymax=y+(1.96*se),width= 0.5, colour = x, shape=x))
g+  coord_cartesian(ylim=c(0,1)) +
geom_pointrange(size= 0.25, position = position_dodge(width=.5)) +
scale_shape_manual(name="Treatment",values=c(4,5),
labels=c("White Candidate","Black Candidate")) +
scale_color_manual(name="Treatment",values=c("grey45","black"),
labels=c("White Candidate","Black Candidate")) +
scale_fill_manual(values=c("grey45","black")) +
#scale_x_discrete(breaks=c("1","2"),labels=c("White \nCandidate","Black \nCandidate"))
coord_flip() +
#geom_hline(yintercept=0, linetype="longdash", size=0.5) +
labs( x = "Dependent Variable", y= "Mean", color = "Category") +
facet_grid(.~rr_def,labeller = label_value,space="free")+
theme_bw()
ggsave(file="welfarePID_figure.pdf",device="pdf",width = 175, height = 125, units = "mm" )
